/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package clks.shattered;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
import javax.swing.JScrollPane;

/**
 *
 * @author 10135228
 */
public class PicturePanel extends javax.swing.JPanel {

    
    JFrame myFrame;
    BufferedImage pictureToDraw;
    /**
     * Creates new form PicturePanel
     */
    public PicturePanel(BufferedImage pictureToDraw) {
        this.pictureToDraw = pictureToDraw;
        initComponents();
        myFrame = new JFrame("Picture");
        myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        myFrame.setContentPane(new JScrollPane(this));

        myFrame.setSize(400,300);
        myFrame.setVisible(true);
        myFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    }

    @Override
    public void paint(Graphics g) {
        super.paint(g);
        g.drawImage(pictureToDraw, 0, 0, null);        
    }

    
    
    
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setPreferredSize(new Dimension(pictureToDraw.getWidth(),pictureToDraw.getHeight()));
        setLayout(null);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
